package com.gitee.magic.converter;

import java.time.LocalDateTime;

import com.gitee.magic.core.converter.AbstractConverterEditor;

/**
 * @author start
 */
public class LocalDateTimeConverterEditor extends AbstractConverterEditor<LocalDateTime> {

	public LocalDateTimeConverterEditor(Class<?> prototype) {
		super(prototype);
	}

	@Override
	public void restore(Object value) {
		if(value!=null) {
			setValue(LocalDateTime.parse(String.valueOf(value)));
		}
	}

	@Override
	public LocalDateTime converter() {
		if(getValue()==null) {
			return null;
		}
        return (LocalDateTime)getValue();
	}

}
